package com.itheima.clientAndService01;

import java.util.Objects;

public class ObjectClass02 {
    public static void main(String[] args) {
        Student stu1 = new Student("鲁班",23);
        Student stu2 = new Student("妲己",25);
        Student stu3 = null;

        String str1 = Objects.toString(stu1);
        System.out.println(str1);

        System.out.println("--------------------------------");

        String str2 = Objects.toString(stu2, "对象为空，我来凑个数");
        System.out.println(str2);
        String str3 = Objects.toString(stu3, "对象为空，我来凑个数");
        System.out.println(str3);

        System.out.println("--------------------------------");

        boolean result1 = Objects.isNull(stu1);
        boolean result2 = Objects.isNull(stu3);
        System.out.println(result1);
        System.out.println(result2);

        System.out.println("--------------------------------");

        boolean result3 = Objects.nonNull(stu2);
        boolean result4 = Objects.nonNull(stu3);
        System.out.println(result3);
        System.out.println(result4);
    }
}
